<template>
  <div
    ref="chart"
    style="width: 100%; height: 400px;"
  />
</template>

<script setup>
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'
const props = defineProps({
  chartData: {
    type: Object,
    default: () => ({})
  }
})
const chart = ref(null)

const initChart = () => {
  const chartInstance = echarts.init(chart.value)
  chartInstance.setOption(props.chartData)
}

onMounted(() => {
  initChart()
})

</script>

<style scoped>
/* 可以在这里添加样式 */
</style>
